﻿namespace Numbrella.TaskSamples.PiMonteCarlo
{
	using System;
	using System.Diagnostics;
	
	[Serializable]
	public class ResultContents 
	{
		public ResultContents(decimal dropsCount, decimal dropsSum)
		{
			this.DropsCount = dropsCount;
		    this.DropsSum = dropsSum;
		}

		public decimal DropsCount { get; private set; }

        public decimal DropsSum { get; private set; }

		public override bool Equals(object obj)
		{
			if (obj == null || GetType() != obj.GetType())
			{
				return false;
			}

			ResultContents objCasted = obj as ResultContents;
			Debug.Assert(objCasted != null, "Value can't be null there.");
			return this.DropsSum == objCasted.DropsSum && this.DropsCount == objCasted.DropsCount;
		}

		public override int GetHashCode()
		{
			return (this.DropsSum / this.DropsCount).GetHashCode();
		}
	}
}
